#include "backgammon.h"

void game(){

    srand((unsigned int)time(NULL));
    char board[ROW][COL] = { 0 };

    //初始化
    InitBoard(board);

    //打印棋盘
    PrintBoard(board);
    char ret = 0;
    while(1){
        //玩家下
        Playermove(board);
        ret = Iswin(board);
        PrintBoard(board);
        //sleep(1);
        if(ret != 'C')
            break;
        //电脑下
#ifdef NDEBUG
        Computermove(board);
        ret = Iswin(board);
        PrintBoard(board);
        //sleep(1);
        if(ret != 'C')
            break;
#endif
    }

    if ('*' == ret) 
    printf("玩家赢\n");
    else if ('#' == ret)
            printf("电脑赢\n");
    else if ('D' == ret)
            printf("平局\n");
}